from typing import List,Union,Optional
from nicegui import ui
from nicegui.element import Element


class DiseaseElement():
    def __init__(self,diseases:List[str]=[],type:str='disease',columns:int=1) -> None:
        self._diseases = ['' for _ in range(4)] if not diseases else diseases
        self._type = type
        self._columns = columns
        self._label='手术或操作' if type=='surgery' else '诊断'   # surgery表示手术,disease表示疾病

        if not self._diseases:
            pass

        if self._diseases:
             pass
        
    def add_element(self):
         with ui.grid(columns='auto '*(len(self._diseases)/4)).classes('w-full text-center').style('gap:0px'):
                    for index,item in enumerate(self._diseases):
                        label_name=f'主要{self._label}' if index==0 else f'其他{self._label}{index}'
                        with ui.select(label=label_name).bind_value().props('dense bordered').add_slot('prepend'):
                            ui.checkbox(on_change=lambda e:ui.notify(e.sender.value)).props('dense borderless')
             